import React, { useState, useEffect } from 'react';
import { Plus, Edit2, Trash2, X, Menu, Phone, Mail, Home, ArrowUp, ArrowDown, Type, LayoutTemplate, FileImage, Lock, Star } from 'lucide-react';
const RenovationWebsite = () => {
const [isAdmin, setIsAdmin] = useState(false);
const [showPasswordModal, setShowPasswordModal] = useState(false);
const [passwordInput, setPasswordInput] = useState("");
const [adminPassword, setAdminPassword] = useState("admin123");
const [editingPassword, setEditingPassword] = useState(false);
const [tempPassword, setTempPassword] = useState("");
const [showAdminPanel, setShowAdminPanel] = useState(false);
const [siteName, setSiteName] = useState("VINT SERVICE");
const [siteSubtitle, setSiteSubtitle] = useState("Multiservice professionnel");
const [themeColor, setThemeColor] = useState("blue");
const [editingSiteSettings, setEditingSiteSettings] = useState(false);
const [tempSiteName, setTempSiteName] = useState("");
const [tempSiteSubtitle, setTempSiteSubtitle] = useState("");
const [tempThemeColor, setTempThemeColor] = useState("blue");
const [showHomePage, setShowHomePage] = useState(true);
const [showRealisations, setShowRealisations] = useState(false);
const [homePageData, setHomePageData] = useState({
title: "Bienvenue chez VINT SERVICE",
subtitle: "Votre partenaire de confiance pour tous vos travaux",
description: "Nous proposons des services professionnels de rénovation et d'entretien pour votre habitat. Qualité, rapidité et satisfaction garanties.",
images: []
});
const [editingHomePage, setEditingHomePage] = useState(false);
const [tempHomeData, setTempHomeData] = useState(homePageData);
const [realisationsData, setRealisationsData] = useState([
{
id: 1,
name: "Projets récents",
images: []
}
]);
const [editingRealisationCategory, setEditingRealisationCategory] = useState(null);
const [tempRealisationName, setTempRealisationName] = useState("");
const themeColors = {
blue: { primary: "blue", secondary: "indigo", gradient: "from-blue-600 to-indigo-600" },
green: { primary: "green", secondary: "emerald", gradient: "from-green-600 to-emerald-600" },
purple: { primary: "purple", secondary: "violet", gradient: "from-purple-600 to-violet-600" },
red: { primary: "red", secondary: "rose", gradient: "from-red-600 to-rose-600" },
orange: { primary: "orange", secondary: "amber", gradient: "from-orange-600 to-amber-600" }
};
const currentTheme = themeColors[themeColor];
const [currentCategory, setCurrentCategory] = useState(null);
const [currentPage, setCurrentPage] = useState(null);
const [showSidebar, setShowSidebar] = useState(false);
const [memo, setMemo] = useState("🏠 Votre partenaire de confiance pour tous vos travaux de rénovation");
const [contact, setContact] = useState({
phone: "06.83.45.58.63",
email: "contact@vintservice.com"
});
const [reviewLink, setReviewLink] = useState("https://g.page/r/votre-lien-avis/review");
const [editingReviewLink, setEditingReviewLink] = useState(false);
const [tempReviewLink, setTempReviewLink] = useState("");
const [categories, setCategories] = useState([
{
id: 1,
name: "Intérieur",
pages: [
{
id: 1,
title: "Nettoyage vitres",
layout: "text-only",
content: [
{ id: 1, type: "text", value: "Service professionnel de nettoyage de vitres pour un résultat impeccable." }
]
}
]
},
{
id: 2,
name: "Extérieur",
pages: [
{
id: 1,
title: "Entretien toiture",
layout: "text-only",
content: [
{ id: 1, type: "text", value: "Maintenance et nettoyage de toiture pour préserver votre habitat." }
]
}
]
}
]);
const [editingMemo, setEditingMemo] = useState(false);
const [editingContact, setEditingContact] = useState(false);
const [editingCategory, setEditingCategory] = useState(null);
const [editingPage, setEditingPage] = useState(null);
const [editingContent, setEditingContent] = useState(null);
const [editingLayout, setEditingLayout] = useState(null);
const [tempMemo, setTempMemo] = useState("");
const [tempContact, setTempContact] = useState({ phone: "", email: "" });
const [tempCategory, setTempCategory] = useState("");
const [tempPage, setTempPage] = useState("");
const [tempContent, setTempContent] = useState("");
const [tempLayout, setTempLayout] = useState("text-only");
const layouts = [
{ id: "text-only", name: "Texte uniquement", icon: Type },
{ id: "image-only", name: "Image uniquement", icon: FileImage },
{ id: "text-image", name: "Texte + Image", icon: LayoutTemplate },
{ id: "image-text", name: "Image + Texte", icon: LayoutTemplate }
];
useEffect(() => {
if (categories.length > 0 && !currentCategory) {
setCurrentCategory(categories[0]);
if (categories[0].pages.length > 0) {
setCurrentPage(categories[0].pages[0]);
}
}
}, [categories, currentCategory]);
const handleAdminToggle = () => {
if (isAdmin) {
setIsAdmin(false);
} else {
setShowPasswordModal(true);
}
};
const handlePasswordSubmit = () => {
if (passwordInput === adminPassword) {
setIsAdmin(true);
setShowPasswordModal(false);
setPasswordInput("");
} else {
alert("Mot de passe incorrect");
setPasswordInput("");
}
};
const addCategory = () => {
const newCat = {
id: Date.now(),
name: "Nouvelle catégorie",
pages: []
};
setCategories([...categories, newCat]);
};
const updateCategory = (id, newName) => {
setCategories(categories.map(cat =>
cat.id === id ? { ...cat, name: newName } : cat
));
setEditingCategory(null);
};
const deleteCategory = (id) => {
setCategories(categories.filter(cat => cat.id !== id));
if (currentCategory?.id === id) {
setCurrentCategory(categories[0] || null);
setCurrentPage(categories[0]?.pages[0] || null);
}
};
const moveCategoryUp = (index) => {
if (index > 0) {
const newCategories = [...categories];
[newCategories[index - 1], newCategories[index]] = [newCategories[index], newCategories[index - 1]];
setCategories(newCategories);
}
};
const moveCategoryDown = (index) => {
if (index < categories.length - 1) {
const newCategories = [...categories];
[newCategories[index], newCategories[index + 1]] = [newCategories[index + 1], newCategories[index]];
setCategories(newCategories);
}
};
const addPage = (categoryId) => {
const newPage = {
id: Date.now(),
title: "Nouvelle page",
layout: "text-only",
content: []
};
setCategories(categories.map(cat =>
cat.id === categoryId
? { ...cat, pages: [...cat.pages, newPage] }
: cat
));
};
const updatePage = (categoryId, pageId, newTitle) => {
setCategories(categories.map(cat =>
cat.id === categoryId
? {
...cat,
pages: cat.pages.map(page =>
page.id === pageId ? { ...page, title: newTitle } : page
)
}
: cat
));
setEditingPage(null);
};
const deletePage = (categoryId, pageId) => {
setCategories(categories.map(cat =>
cat.id === categoryId
? { ...cat, pages: cat.pages.filter(page => page.id !== pageId) }
: cat
));
if (currentPage?.id === pageId) {
const cat = categories.find(c => c.id === categoryId);
setCurrentPage(cat?.pages[0] || null);
}
};
const movePageUp = (categoryId, pageIndex) => {
if (pageIndex > 0) {
setCategories(categories.map(cat => {
if (cat.id === categoryId) {
const newPages = [...cat.pages];
[newPages[pageIndex - 1], newPages[pageIndex]] = [newPages[pageIndex], newPages[pageIndex - 1]];
return { ...cat, pages: newPages };
}
return cat;
}));
}
};
const movePageDown = (categoryId, pageIndex) => {
setCategories(categories.map(cat => {
if (cat.id === categoryId && pageIndex < cat.pages.length - 1) {
const newPages = [...cat.pages];
[newPages[pageIndex], newPages[pageIndex + 1]] = [newPages[pageIndex + 1], newPages[pageIndex]];
return { ...cat, pages: newPages };
}
return cat;
}));
};
const updatePageLayout = (categoryId, pageId, newLayout) => {
setCategories(categories.map(cat =>
cat.id === categoryId
? {
...cat,
pages: cat.pages.map(page =>
page.id === pageId ? { ...page, layout: newLayout } : page
)
}
: cat
));
setEditingLayout(null);
};
const addContent = (categoryId, pageId, type) => {
const newContent = {
id: Date.now(),
type: type,
value: type === "text" ? "Nouveau contenu" : ""
};
setCategories(prevCategories => {
const updatedCategories = prevCategories.map(cat => {
if (cat.id === categoryId) {
return {
...cat,
pages: cat.pages.map(page => {
if (page.id === pageId) {
return {
...page,
content: [...page.content, newContent]
};
}
return page;
})
};
}
return cat;
});
// Mettre à jour la page courante pour forcer le re-render
const currentCat = updatedCategories.find(c => c.id === categoryId);
const updatedPage = currentCat?.pages.find(p => p.id === pageId);
if (updatedPage) {
setCurrentPage({...updatedPage});
}
console.log("Updated categories:", updatedCategories);
return updatedCategories;
});
};
const updateContent = (categoryId, pageId, contentId, newValue) => {
setCategories(prevCategories => {
const updatedCategories = prevCategories.map(cat => {
if (cat.id === categoryId) {
return {
...cat,
pages: cat.pages.map(page => {
if (page.id === pageId) {
return {
...page,
content: page.content.map(item => {
if (item.id === contentId) {
return { ...item, value: newValue };
}
return item;
})
};
}
return page;
})
};
}
return cat;
});
// Mettre à jour la page courante pour forcer le re-render
const currentCat = updatedCategories.find(c => c.id === categoryId);
const updatedPage = currentCat?.pages.find(p => p.id === pageId);
if (updatedPage) {
setCurrentPage({...updatedPage});
}
return updatedCategories;
});
setEditingContent(null);
};
const deleteContent = (categoryId, pageId, contentId) => {
setCategories(prevCategories => {
const updatedCategories = prevCategories.map(cat => {
if (cat.id === categoryId) {
return {
...cat,
pages: cat.pages.map(page => {
if (page.id === pageId) {
return {
...page,
content: page.content.filter(item => item.id !== contentId)
};
}
return page;
})
};
}
return cat;
});
return updatedCategories;
});
};
const handleImageUpload = (categoryId, pageId, contentId, e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (event) => {
updateContent(categoryId, pageId, contentId, event.target.result);
// Force un re-render en mettant à jour la page courante
setCategories(prevCategories => {
const updatedCats = prevCategories.map(cat =>
cat.id === categoryId
? {
...cat,
pages: cat.pages.map(page =>
page.id === pageId
? {
...page,
content: page.content.map(item =>
item.id === contentId ? { ...item, value: event.target.result } : item
)
}
: page
)
}
: cat
);
// Mettre à jour la page courante
const currentCat = updatedCats.find(c => c.id === categoryId);
const updatedPage = currentCat?.pages.find(p => p.id === pageId);
if (updatedPage) {
setCurrentPage({...updatedPage});
}
return updatedCats;
});
};
reader.readAsDataURL(file);
}
};
const selectPage = (category, page) => {
setShowHomePage(false);
setShowRealisations(false);
setCurrentCategory(category);
setCurrentPage(page);
setShowSidebar(false);
};
const goToHomePage = () => {
setShowHomePage(true);
setShowRealisations(false);
setCurrentCategory(null);
setCurrentPage(null);
setShowSidebar(false);
};
const goToRealisations = () => {
setShowHomePage(false);
setShowRealisations(true);
setCurrentCategory(null);
setCurrentPage(null);
setShowSidebar(false);
};
const handleHomeImageUpload = (index, e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (event) => {
setHomePageData(prev => {
const newImages = [...prev.images];
newImages[index] = event.target.result;
return { ...prev, images: newImages };
});
};
reader.readAsDataURL(file);
}
};
const addHomeImage = () => {
setHomePageData(prev => ({
...prev,
images: [...prev.images, ""]
}));
};
const deleteHomeImage = (index) => {
setHomePageData(prev => ({
...prev,
images: prev.images.filter((_, i) => i !== index)
}));
};
const addRealisationCategory = () => {
const newCat = {
id: Date.now(),
name: "Nouvelle catégorie",
images: []
};
setRealisationsData([...realisationsData, newCat]);
};
const updateRealisationCategory = (id, newName) => {
setRealisationsData(realisationsData.map(cat =>
cat.id === id ? { ...cat, name: newName } : cat
));
setEditingRealisationCategory(null);
};
const deleteRealisationCategory = (id) => {
setRealisationsData(realisationsData.filter(cat => cat.id !== id));
};
const handleRealisationImageUpload = (categoryId, index, e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (event) => {
setRealisationsData(prev => prev.map(cat => {
if (cat.id === categoryId) {
const newImages = [...cat.images];
newImages[index] = event.target.result;
return { ...cat, images: newImages };
}
return cat;
}));
};
reader.readAsDataURL(file);
}
};
const addRealisationImage = (categoryId) => {
setRealisationsData(prev => prev.map(cat =>
cat.id === categoryId ? { ...cat, images: [...cat.images, ""] } : cat
));
};
const deleteRealisationImage = (categoryId, index) => {
setRealisationsData(prev => prev.map(cat =>
cat.id === categoryId ? { ...cat, images: cat.images.filter((_, i) => i !== index) } : cat
));
};
const renderContent = (page) => {
if (!page || !page.content || page.content.length === 0) {
return
Aucun contenu pour le moment
;
}
return (
{page.content.map((item) => (
{item.type === "text" ? (
) : (
{item.value ? (
) : (
Cliquez sur modifier pour charger une image
)}
)}
{isAdmin && (
{
if (item.type === "text") {
setTempContent(item.value);
setEditingContent({
categoryId: currentCategory.id,
pageId: currentPage.id,
contentId: item.id
});
} else {
document.getElementById(`image-upload-${item.id}`).click();
}
}}
className="p-2 hover:bg-blue-50 rounded transition-colors"
title={item.type === "text" ? "Modifier le texte" : "Modifier l'image"}
>
{
if (confirm("Voulez-vous vraiment supprimer cet élément ?")) {
deleteContent(currentCategory.id, currentPage.id, item.id);
}
}}
className="p-2 hover:bg-red-50 rounded transition-colors"
title="Supprimer"
>
{item.type === "image" && (
handleImageUpload(currentCategory.id, currentPage.id, item.id, e)}
/>
)}
)}
))}
);
};
return (
{siteName}
{siteSubtitle}
setShowSidebar(!showSidebar)}
className="lg:hidden p-2 rounded-lg hover:bg-blue-50 transition-colors"
>
Accueil
Nos réalisations
{contact.email}
{memo && (
{memo}
{isAdmin && (
{ setTempMemo(memo); setEditingMemo(true); }}
className={`p-1.5 hover:bg-${currentTheme.primary}-700 rounded-lg transition-colors`}
>
setMemo("")}
className={`p-1.5 hover:bg-${currentTheme.primary}-700 rounded-lg transition-colors`}
>
)}
)}
{isAdmin && !memo && (
{ setTempMemo("Nouveau mémo"); setEditingMemo(true); }}
className={`text-sm text-${currentTheme.primary}-800 hover:text-${currentTheme.primary}-900 font-bold flex items-center space-x-1`}
>
Ajouter un mémo
)}
{[...Array(30)].map((_, i) => (
))}
{showHomePage ? (
{homePageData.title}
{homePageData.subtitle}
{homePageData.description}
{isAdmin && (
{
setTempHomeData(homePageData);
setEditingHomePage(true);
}}
className={`mt-6 px-6 py-3 bg-gradient-to-r ${currentTheme.gradient} text-white rounded-xl hover:shadow-lg transition-all font-bold flex items-center space-x-2 mx-auto`}
>
Modifier la page d'accueil
)}
{homePageData.images.length > 0 && (
{homePageData.images.map((img, index) => (
{img ? (
) : (
)}
{isAdmin && (
document.getElementById(`home-img-${index}`).click()}
className="p-2 hover:bg-blue-50 rounded"
>
deleteHomeImage(index)}
className="p-2 hover:bg-red-50 rounded"
>
handleHomeImageUpload(index, e)}
/>
)}
))}
)}
{isAdmin && (
)}
Nos services
{categories.map(category => (
{
setCurrentCategory(category);
if (category.pages.length > 0) {
setCurrentPage(category.pages[0]);
}
setShowHomePage(false);
}}
className="w-full text-left mb-4"
>
{category.name}
{category.pages.map(page => (
{
setCurrentCategory(category);
setCurrentPage(page);
setShowHomePage(false);
}}
className="w-full p-3 bg-white rounded-lg hover:shadow-md transition-all text-left group"
>
{page.title}
{page.content?.length || 0} élément{page.content?.length > 1 ? 's' : ''}
))}
))}
) : showRealisations ? (
Nos Réalisations
{realisationsData.map((category) => (
{category.name}
{isAdmin && (
{
setTempRealisationName(category.name);
setEditingRealisationCategory(category.id);
}}
className="p-2 bg-blue-100 hover:bg-blue-200 rounded-lg transition-colors"
>
{
if (confirm("Supprimer cette catégorie ?")) {
deleteRealisationCategory(category.id);
}
}}
className="p-2 bg-red-100 hover:bg-red-200 rounded-lg transition-colors"
>
)}
{category.images.map((img, index) => (
{img ? (
window.open(img, '_blank')}
/>
) : (
)}
{isAdmin && (
document.getElementById(`realisation-img-${category.id}-${index}`).click()}
className="p-2 hover:bg-blue-50 rounded"
>
deleteRealisationImage(category.id, index)}
className="p-2 hover:bg-red-50 rounded"
>
handleRealisationImageUpload(category.id, index, e)}
/>
)}
))}
{isAdmin && (
addRealisationImage(category.id)}
className={`mt-6 px-6 py-3 bg-gradient-to-r from-${currentTheme.secondary}-500 to-${currentTheme.secondary}-600 text-white rounded-xl hover:shadow-lg transition-all font-bold flex items-center space-x-2`}
>
Ajouter une photo
)}
))}
{isAdmin && (
Nouvelle catégorie de réalisations
)}
) : currentPage ? (
{currentPage.title}
{isAdmin && (
{
setTempLayout(currentPage.layout);
setEditingLayout({ categoryId: currentCategory.id, pageId: currentPage.id });
}}
className="px-4 py-2 bg-blue-100 text-blue-700 rounded-lg hover:bg-blue-200 transition-colors flex items-center space-x-2 font-bold"
>
Mise en page
)}
{renderContent(currentPage)}
{isAdmin && currentPage && (
Ajouter du contenu :
{
e.preventDefault();
e.stopPropagation();
console.log("Ajout texte - Current:", currentCategory?.id, currentPage?.id);
if (currentCategory && currentPage) {
addContent(currentCategory.id, currentPage.id, "text");
}
}}
className="flex-1 px-5 py-3 bg-gradient-to-r from-blue-500 to-blue-600 text-white rounded-xl hover:from-blue-600 hover:to-blue-700 transition-all shadow-lg flex items-center justify-center space-x-2 font-bold"
>
Ajouter du texte
{
e.preventDefault();
e.stopPropagation();
console.log("Ajout image - Current:", currentCategory?.id, currentPage?.id);
if (currentCategory && currentPage) {
addContent(currentCategory.id, currentPage.id, "image");
}
}}
className="flex-1 px-5 py-3 bg-gradient-to-r from-indigo-500 to-indigo-600 text-white rounded-xl hover:from-indigo-600 hover:to-indigo-700 transition-all shadow-lg flex items-center justify-center space-x-2 font-bold"
>
Ajouter une image
)}
) : (
Bienvenue sur {siteName}
{currentCategory && currentCategory.pages.length === 0
? "Cette catégorie ne contient pas encore de pages"
: "Sélectionnez une catégorie pour découvrir nos services"
}
{isAdmin && currentCategory && currentCategory.pages.length === 0 && (
addPage(currentCategory.id)}
className="px-6 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 text-white rounded-xl hover:from-blue-700 hover:to-indigo-700 transition-all shadow-lg flex items-center space-x-2 font-bold mx-auto"
>
Créer la première page
)}
)}
Contactez-nous
{contact.email}
Laisser un avis
{isAdmin && (
setShowAdminPanel(true)}
className="px-4 py-2 bg-gradient-to-r from-purple-600 to-purple-700 hover:from-purple-700 hover:to-purple-800 rounded-xl transition-all shadow-lg flex items-center space-x-2 font-bold text-sm"
>
Paramètres site
{ setTempContact(contact); setEditingContact(true); }}
className="flex-1 px-4 py-2 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 rounded-xl transition-all shadow-lg flex items-center space-x-2 font-bold text-sm"
>
Contact
{ setTempReviewLink(reviewLink); setEditingReviewLink(true); }}
className="flex-1 px-4 py-2 bg-gradient-to-r from-yellow-600 to-yellow-700 hover:from-yellow-700 hover:to-yellow-800 rounded-xl transition-all shadow-lg flex items-center space-x-2 font-bold text-sm"
>
Lien avis
{ setTempPassword(adminPassword); setEditingPassword(true); }}
className="px-4 py-2 bg-gradient-to-r from-red-600 to-red-700 hover:from-red-700 hover:to-red-800 rounded-xl transition-all shadow-lg flex items-center space-x-2 font-bold text-sm"
>
Mot de passe
)}
{isAdmin ? '🔓' : '🔒'}
{showPasswordModal && (
Accès administrateur
Entrez le mot de passe pour continuer
setPasswordInput(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && handlePasswordSubmit()}
placeholder="Mot de passe"
className="w-full px-4 py-3 border-2 border-blue-200 rounded-xl mb-6 focus:border-blue-500 focus:outline-none font-medium"
autoFocus
/>
Valider
{ setShowPasswordModal(false); setPasswordInput(""); }}
className="flex-1 px-4 py-3 bg-stone-200 text-stone-700 rounded-xl hover:bg-stone-300 font-bold"
>
Annuler
)}
{editingMemo && (
)}
{editingContact && (
Modifier les contacts
{ setContact(tempContact); setEditingContact(false); }}
className="flex-1 px-4 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 text-white rounded-xl hover:from-blue-700 hover:to-indigo-700 font-bold shadow-lg"
>
Enregistrer
setEditingContact(false)}
className="flex-1 px-4 py-3 bg-stone-200 text-stone-700 rounded-xl hover:bg-stone-300 font-bold"
>
Annuler
)}
{editingReviewLink && (
)}
{editingRealisationCategory && (
)}
{editingHomePage && (
Modifier la page d'accueil
{
setHomePageData(tempHomeData);
setEditingHomePage(false);
}}
className="flex-1 px-4 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 text-white rounded-xl hover:from-blue-700 hover:to-indigo-700 font-bold shadow-lg"
>
Enregistrer
setEditingHomePage(false)}
className="flex-1 px-4 py-3 bg-stone-200 text-stone-700 rounded-xl hover:bg-stone-300 font-bold"
>
Annuler
)}
{showAdminPanel && (
Paramètres du site
setShowAdminPanel(false)} className="p-2 hover:bg-stone-100 rounded-lg">
setShowAdminPanel(false)}
className="w-full mt-6 px-4 py-3 bg-gradient-to-r from-purple-600 to-purple-700 text-white rounded-xl hover:from-purple-700 hover:to-purple-800 font-bold shadow-lg"
>
Fermer
)}
{editingPassword && (
Modifier le mot de passe admin
Choisissez un nouveau mot de passe
setTempPassword(e.target.value)}
placeholder="Nouveau mot de passe"
className="w-full px-4 py-3 border-2 border-red-200 rounded-xl mb-6 focus:border-red-500 focus:outline-none font-medium"
/>
{ setAdminPassword(tempPassword); setEditingPassword(false); }}
className="flex-1 px-4 py-3 bg-gradient-to-r from-red-600 to-red-700 text-white rounded-xl hover:from-red-700 hover:to-red-800 font-bold shadow-lg"
>
Enregistrer
setEditingPassword(false)}
className="flex-1 px-4 py-3 bg-stone-200 text-stone-700 rounded-xl hover:bg-stone-300 font-bold"
>
Annuler
)}
{editingCategory && (
)}
{editingPage && (
)}
{editingContent && (
)}
{editingLayout && (
Choisir la mise en page
{layouts.map(layout => {
const Icon = layout.icon;
return (
setTempLayout(layout.id)}
className={`p-6 rounded-xl border-2 transition-all ${
tempLayout === layout.id
? 'border-blue-600 bg-blue-50 shadow-lg'
: 'border-stone-200 hover:border-blue-300 hover:bg-blue-50'
}`}
>
{layout.name}
);
})}
updatePageLayout(editingLayout.categoryId, editingLayout.pageId, tempLayout)}
className="flex-1 px-4 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 text-white rounded-xl hover:from-blue-700 hover:to-indigo-700 font-bold shadow-lg"
>
Enregistrer
setEditingLayout(null)}
className="flex-1 px-4 py-3 bg-stone-200 text-stone-700 rounded-xl hover:bg-stone-300 font-bold"
>
Annuler
)}
);
};
export default RenovationWebsite;